package main

import (
	"context"
	"flag"
	"fmt"
	"github.com/zeromicro/go-zero/core/conf"
	"github.com/zeromicro/go-zero/zrpc"
	"greet-client/greetclient"
	"greet-client/internal/config"
)

var configFile = flag.String("f", "etc/greet-client.yaml", "the config file")

func main() {
	flag.Parse()
	var c config.Config
	conf.MustLoad(*configFile, &c)

	client, err := zrpc.NewClient(c.RpcClientConf)
	if err != nil {
		return
	}
	greet := greetclient.NewGreet(client)
	ping, err := greet.Ping(context.Background(), &greetclient.Request{Ping: "ping789"})
	if err != nil {
		return
	}
	fmt.Println(ping.GetPong())
}
